module.exports = {
    minifyHtml(html) {
        return require('html-minifier').minify(html, {
            continueOnParseError: true,
            collapseBooleanAttributes: true,
            collapseWhitespace: true,
            collapseInlineTagWhitespace: true,
            removeComments: true,
            removeEmptyAttributes: true,
            removeEmptyElements: true,
            removeOptionalTags: true,
            removeRedundantAttributes: true,
            removeScriptTypeAttributes: true,
            removeStyleLinkTypeAttributes: true,
            sortAttributes: true,
            sortClassName: true,
        })
    },

    initKnex({
        host,
        port,
        user,
        password,
        database,
    }) {
        return require('knex')({
            client: 'mysql',
            connection: {
                host: _.defaultTo(host, '127.0.0.1'),
                port: _.toNumber(_.defaultTo(port, 3306)),
                user: _.defaultTo(user, 'root'),
                password: _.defaultTo(password, 'root'),
                database: _.defaultTo(database, 'test'),
                charset: 'utf8mb4',
            },
            pool: {min: 0, max: 7, idleTimeoutMillis: 5000,}
        })
    },
}